package ru.mirent;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import ru.mirent.app.aspect.SchemeAspect;
import ru.mirent.app.entity.Account;
import ru.mirent.schemegenerator.Painter;

import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

@Slf4j
public class AccountTest {

    private Account account;

    @BeforeEach
    public void before() {
        account = new Account(20);
    }

    @Test
    public void firstAccountTest() {

//        LOGGER.info("[AccountTest.java] Запущен тест: firstAccountTest");
        assertTrue(account.withdraw(5));
        System.out.println("[AccountTest.java] Остановлен тест: firstAccountTest");
    }

    @Test
    public void secondAccountTest() {
        System.out.println("[AccountTest.java] Запущен тест: secondAccountTest");
        assertFalse(account.withdraw(100));
        System.out.println("[AccountTest.java] Остановлен тест: secondAccountTest");
    }

    @AfterEach
    void tearDown() {
        Painter painter = new Painter(SchemeAspect.partList.get(0));
        for (int i = 0; i < SchemeAspect.partList.size(); i++) {
            painter.addInteractFromActiveAndChangeActiveToCurrent(SchemeAspect.partList.get(i));
        }
        painter.showInteract();
        painter.showNames();

        SchemeAspect.partList.clear();
    }
}
